package com.qf.day30_springbootstarter.conf;

import com.qf.day30_springbootstarter.utils.FileAppender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

@Configuration
@EnableConfigurationProperties(Properties.class)
public class AutoConfiguration {

    @Autowired
    Properties properties;

    @Bean
    public FileAppender fileAppender() throws IOException {

        final FileAppender fileAppender = new FileAppender(properties.getFilepath());

        return fileAppender;

    }

}
